import js from '@eslint/js'
import vue from 'eslint-plugin-vue'
import globals from 'globals'
import vueParser from 'vue-eslint-parser'

export default [
    js.configs.recommended,
    ...vue.configs['flat/recommended'],
    {
        files: ['**/*.js'],
        languageOptions: {
            ecmaVersion: 'latest',
            sourceType: 'module',
            globals: {
                ...globals.browser
            }
        },
        rules: {
            'eqeqeq': 'warn',
            'no-unused-vars': ['warn', {
                vars: 'local',
                args: 'none'
            }],
            'no-undef': 'warn',
            'no-useless-escape': 'warn',
            'no-empty': 'off',
            'brace-style': ['error', '1tbs', {allowSingleLine: false}]
        }
    },
    {
        files: ['**/*.vue'],
        languageOptions: {
            parser: vueParser,
            parserOptions: {
                ecmaVersion: 'latest',
                sourceType: 'module'
            },
            globals: {
                ...globals.browser
            }
        },
        plugins: {
            vue
        },
        rules: {
            'eqeqeq': 'warn',
            'no-unused-vars': ['warn', {
                vars: 'local',
                args: 'none'
            }],
            'no-undef': 'warn',
            'no-useless-escape': 'warn',
            'no-empty': 'off',
            'vue/no-side-effects-in-computed-properties': 'warn',
            'vue/no-mutating-props': 'warn',
            'brace-style': ['error', '1tbs', {allowSingleLine: false}]
        }
    }
]
